//
//  ElectronNumTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/8/4.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "ElectronNumTableViewCell.h"

@implementation ElectronNumTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.backgroundColor = SFM242;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.titleLabel];
    [self.bgView addSubview:self.moneyLabel];
//    [self.bgView addSubview:self.lastLabel];
//    [self.bgView addSubview:self.lastDegreeNumLabel];
//    [self.bgView addSubview:self.currentLabel];
//    [self.bgView addSubview:self.currentDetailLabel];
//    [self.bgView addSubview:self.reallyLabel];
//    [self.bgView addSubview:self.reallyDetailLabel];
//    [self.bgView addSubview:self.dashedView];
//    [self drawDashLine:self.dashedView lineLength:4 lineSpacing:1 lineColor:SFM242];
}

-(UIView *)bgView
{
    if (_bgView == nil) {
        _bgView = [[UIView alloc] initWithFrame:CGRectMake(15, 0, WIDTH - 30, 25)];
        _bgView.backgroundColor = SFMWhiteColor;
    }
    return _bgView;
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 100, 25)];
        _titleLabel.font = font(14);
        _titleLabel.textColor = SFM153;
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

-(UILabel *)moneyLabel
{
    if (_moneyLabel == nil) {
        _moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, 0, WIDTH - 180, 25)];
        _moneyLabel.font = font(14);
        _moneyLabel.textColor = SFMColor(246, 110, 36);
        _moneyLabel.textAlignment = NSTextAlignmentRight;
    }
    return _moneyLabel;
}

//-(UILabel *)lastLabel
//{
//    if (_lastLabel == nil) {
//        _lastLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 45, WIDTH/3 - 10, 17)];
//        _lastLabel.font = font(14);
//        _lastLabel.textColor = SFM153;
//        _lastLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _lastLabel;
//}
//
//-(UILabel *)lastDegreeNumLabel
//{
//    if (_lastDegreeNumLabel == nil) {
//        _lastDegreeNumLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 65, WIDTH/3 - 10, 17)];
//        _lastDegreeNumLabel.font = font(14);
//        _lastDegreeNumLabel.textColor = SFM153;
//        _lastDegreeNumLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _lastDegreeNumLabel;
//}
//
//-(UILabel *)currentLabel
//{
//    if (_currentLabel == nil) {
//        _currentLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/3 - 10, 45, WIDTH/3 - 10, 17)];
//        _currentLabel.font = font(14);
//        _currentLabel.textColor = SFM153;
//        _currentLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _currentLabel;
//}
//
//-(UILabel *)currentDetailLabel
//{
//    if (_currentDetailLabel == nil) {
//        _currentDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/3 - 10, 65, WIDTH/3 - 10, 17)];
//        _currentDetailLabel.font = font(14);
//        _currentDetailLabel.textColor = SFM153;
//        _currentDetailLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _currentDetailLabel;
//}
//
//-(UILabel *)reallyLabel
//{
//    if (_reallyLabel == nil) {
//        _reallyLabel = [[UILabel alloc] initWithFrame:CGRectMake((2*WIDTH)/3 - 20, 45, WIDTH/3 - 10, 17)];
//        _reallyLabel.font = font(14);
//        _reallyLabel.textColor = SFM153;
//        _reallyLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _reallyLabel;
//}
//
//-(UILabel *)reallyDetailLabel
//{
//    if (_reallyDetailLabel == nil) {
//        _reallyDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake((2*WIDTH)/3 - 20, 65, WIDTH/3 - 10, 17)];
//        _reallyDetailLabel.font = font(14);
//        _reallyDetailLabel.textColor = SFM153;
//        _reallyDetailLabel.textAlignment = NSTextAlignmentCenter;
//    }
//    return _reallyDetailLabel;
//}
//
//-(UIView *)dashedView
//{
//    if (_dashedView == nil) {
//        _dashedView = [[UIView alloc] initWithFrame:CGRectMake(20, 57, WIDTH - 70, 1)];
//        _dashedView.hidden = YES;
//    }
//    return _dashedView;
//}


//- (void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor
//{
//    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
//    [shapeLayer setBounds:lineView.bounds];
//    [shapeLayer setPosition:CGPointMake(CGRectGetWidth(lineView.frame) / 2, CGRectGetHeight(lineView.frame))];
//    [shapeLayer setFillColor:[UIColor clearColor].CGColor];
//
//    //  设置虚线颜色为
//    [shapeLayer setStrokeColor:lineColor.CGColor];
//
//    //  设置虚线宽度
//    [shapeLayer setLineWidth:CGRectGetHeight(lineView.frame)];
//    [shapeLayer setLineJoin:kCALineJoinRound];
//
//    //  设置线宽，线间距
//    [shapeLayer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:lineLength], [NSNumber numberWithInt:lineSpacing], nil]];
//
//    //  设置路径
//    CGMutablePathRef path = CGPathCreateMutable();
//    CGPathMoveToPoint(path, NULL, 0, 0);
//    CGPathAddLineToPoint(path, NULL, CGRectGetWidth(lineView.frame), 0);
//
//    [shapeLayer setPath:path];
//    CGPathRelease(path);
//
//    //  把绘制好的虚线添加上来
//    [lineView.layer addSublayer:shapeLayer];
//}

-(void)send
{
//    self.lastLabel.text = @"上去读数";
//    self.lastDegreeNumLabel.text = @"65度";
//    self.currentLabel.text = @"本期读数";
//    self.currentDetailLabel.text = @"67度";
//    self.reallyLabel.text = @"实际用量";
//    self.reallyDetailLabel.text = @"2度";
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
